package cz.zcu.fav.rat.rest.factory;
import org.springframework.stereotype.Component;

import cz.zcu.fav.rat.beans.User;
import cz.zcu.fav.rat.rest.beans.UserMapping;

@Component
public class UserMappingFactory extends AbstractMappingFactory<UserMapping, User>
{

	@Override
	public UserMapping getObject()
	{
		return new UserMapping();
	}

	@Override
	public Class<?> getObjectType()
	{
		return UserMapping.class;
	}

	@Override
	public UserMapping getMappedObject(User object)
	{
		UserMapping mapping = getObject();
		mapping.setId(object.getId());
		mapping.setName(object.getNickname());
		mapping.setEmail(object.getEmail());
		return mapping;
	}

	@Override
	public User getRemappedObject(UserMapping object, boolean ignoreId)
	{
		throw new UnsupportedOperationException("not implemented");
	}
}
